//personal vision
/*测试一个函数，从一行输入中把单词读入一个数组中，要求跳过第一个非空白字符前面的
所有空白并且丢弃该输入除该单词以外的所有数*/
#include <stdio.h>
//function
void getwords(char *zu);

int main(void)
{
	char word[20];
	printf("test\n");
	getwords(word);
	return 0;
}

void getwords(char* zu)
{
	char k;
	int temp = 0;
	k = getchar();
	while (k == ' ')
		k = getchar();
	while (k != ' '&&k!='\n')
	{
		*(zu + temp) = k;
		printf("%c", *(zu + temp));
		k = getchar();
		temp++;
	}
	k=getchar();
	while (k != '\n')
		getchar();
}
//下面是参考答案
/* Programming Exercise 11-3 */
#include <stdio.h>
#define LEN 80
char * getword(char * str);
int main(void)
{
 char input[LEN];

 while (getword(input) != NULL)
 puts(input);
 puts("Done.\n");

 return 0;
}
#include <ctype.h>
char * getword(char * str)
{
 int ch;
 char * orig = str;
// skip over initial whitespace
 while ((ch = getchar()) != EOF && isspace(ch))
 continue;
 if (ch == EOF)
 return NULL;
 else
 *str++ = ch; // first character in word
// get rest of word
 while ((ch = getchar()) != EOF && !isspace(ch))
 *str++ = ch;
 *str = '\0';
 if (ch == EOF)
 return NULL;
 else
 {
 while (ch != '\n')
 ch = getchar();
 return orig;
 }
}